<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app"></div>
<!--引入react核心库-->
<script src="../React-js/react.development.js"></script>
<!--引入reac-dom 用于支持react操作dom-->
<script src="../React-js/react-dom.development.js"></script>
<!--显示props数据类型显示-->
<script src="../React-js/prop-types.js"></script>

<!--引入babel 用于讲jsx语法转js语法-->
<script src="../React-js/babel.min.js"></script>
<script type="text/babel">

    class LolInput extends React.Component {

        render() {
            return <div>
                <input ref="input_1" placeholder="请输入"/>
                <button onClick={()=>this.showVal('input_1')}>弹出内容</button>
                <input ref="input_2" onBlur={()=>this.showVal('input_2')} placeholder="失去焦点，自动弹出内容"/>
            </div>
        }

        showVal = (field) => {
            console.log(field)
            const dom = this.refs[field]
            alert(dom.value)

        }


    }


    ReactDOM.render(<LolInput/>, document.getElementById('app'))
</script>
</body>
</html>